import Vue from 'vue'
import VueRouter from "vue-router";
Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    {
      path: '/',
      component: () => import('@/views/Layout.vue'),
      redirect: '/article',
      children: [
        // 通过 children 配置项，可以配置嵌套子路由
        //1.在children配置项中，配规则
        //2.准备二级路由出口
        {
          path: '/article',
          component: () => import('@/views/Article.vue'),
        },
        {
          path: '/Like',
          component: () => import('@/views/Like.vue'),
        },
        {
          path: '/User',
          component: () => import('@/views/User.vue'),
        },
        {
          path: '/collect',
          component: () => import('@/views/Collect.vue'),
        }
      ]
    },
    {
      path: '/detail/:id',
      component: () => import('@/views/ArticleDetail.vue'),
    }
  ]
})

export default router